<div id="main_list" class="span-24 last main">
    <div class="span-18">
        <div class="section_local_ads">
            <h2><?
              if ($_GET['ad_type'] == 1) {
                 $ad_type_txt = 'Give';
              }
              if ($_GET['ad_type'] == 2) {
                 $ad_type_txt = 'Want';
              }
              
                        echo $this->translate('Search results for') . ' ('.$this->translate((string)$ad_type_txt).') "' . $this->escape($this->q) . '"';    ?>
            </h2>
                
                <div class="give-want">
                    <a class="<?=(preg_match("/ad_type=1/", $_SERVER['REQUEST_URI']))?"actual_give-want":"give"?>
                       " href='/<?=$this->lang?>/search/?ad_type=1&q=<?=$this->escape($this->q) ?>'><?=$this->translate ( 'Give' );?></a>
                    &nbsp;
                    <a class="<?=(preg_match("/ad_type=2/", $_SERVER['REQUEST_URI']))?"actual_give-want":"want"?>
                       " href='/<?=$this->lang?>/search/?ad_type=2&q=<?=$this->escape($this->q) ?>' ><?=$this->translate ( 'Want' );?></a>
                </div>
                
            <?='<div class="ads_found">'.$this->translate('Found').' '.$this->total_found. ' '.$this->translate('results in'). ' '.$this->query_time. ' '.$this->translate('seconds.'). '</div> ' ?>
                        
                <?php
                if (count($this->mensajes) > 0) {
                    echo '<div class="success">';
                    foreach ($this->mensajes as $msg) {
                        echo $msg . '<br>';
                    }
                    echo '</div>';
                }
                ?>

        <?php if ($this->search ): ?>

        <?php foreach ($this->search as $key => $val):
                    //Zend_Debug::dump($val); ?>


        <div class="ad_excerpt">

            <?php
                if ($val['photo'] !== null) {
                    echo '<div class="ad_list_image">
                                  <a href="/' . $this->lang . '/ad/show/id/' . $this->escape($val['id']) . '/' . $this->escape($val['title']) . ' ">
                                  <img alt="' . $this->escape($val['title']) . '" src="/images/uploads/ads/100/' .
                    $this->escape($val['photo']) . '" /></a></div>';               
                } else {
                              echo '<div class="ad_list_image">';                 
                              if ($this->lang == 'es') {
                                  echo '<a href="/'.$this->lang.'/ad/show/id/'.$this->escape($val['id']).'/'.$this->escape($val['title']).' ">
                                <img alt="'.$this->escape($val['title']).'" src="/images/sin_imagen.jpg" /></a></div>';
                              } else {
                                  echo '<a href="/'.$this->lang.'/ad/show/id/'.$this->escape($val['id']).'/'.$this->escape($val['title']).' ">
                                <img alt="'.$this->escape($val['title']).'" src="/images/no_image.jpg" /></a></div>';
                              }
                             }
            ?>
            <?
               if ($val['type'] == 1){
                   $val['type_name'] = 'give';
               }
               if ($val['type'] == 2){
                   $val['type_name'] = 'want';
               }
            ?>

            <?php if ($val['type'] == 1): ?>
                  <span class="ad_status <?=$val['status'] ?>"><?=$this->translate($val['status']) ?></span>
                  <?php endif;?>
          
                  <div class="ad_excerpt_title"><a class="ad_title_link" href="/<?=$this->lang ?>/ad/show/id/<?=$this->escape($val['id']).'/'.$this->escape($val['title']) ?>">
                         <?=$this->escape($val['title']) ?></a></div>
                  
                  <span class="ad_date"><?=$this->translate('Posted on '). $this->escape(date( $this->translate('l dS \o\f F Y H:i:s'), strtotime($val['date_created']))) ?>
                          <?=$this->translate('by user ') ?>
                        <a class="ads_section" href="/<?=$this->lang ?>/ad/listuser/id/<?=$val['user_owner'] ?>"><?=$this->escape($val['username']) ?></a>
                      </span>
                                                                
                      <div class="ad_body"><p><?php echo $this->escapeEmail( $this->escape($val['body']) ) ?></p></div>
                    
                     <div class="ad_meta_info">
              <?php if ($val['readings_count']): ?>
                 <div class="readings_count"><?=$val['readings_count'] . ' ' . $this->translate('readings') ?></div>
              <?php endif; ?>
                          <?php if ($val['comments_count']): ?>
                 <div class="comments_count"><?=', ' . $this->escape($val['comments_count'] == null ? 0 : $val['comments_count']) . ' ' . $this->translate('comments') ?></div>
                            <?php endif; ?>
           </div>
               </div>
               <?php endforeach; ?>
            
          <?php else: ?>
                    <div class="no_results">
                        <h3><?=$this->translate ( 'No ads to display for this location.');?></h3>
                        <h5><?=$this->translate ( 'You could try one of these things:');?></h5>
                        <h5>1. <?=$this->translate ( 'Be the first to').' ';?>
                           <a class="ads_section" href="/<?=$this->lang?>/ad/create"><?=$this->translate ('Post an ad on this location.');?></a></h5>
                        <h5>2. <?=$this->translate ( 'Try to change the location to another city bigger near you.');?></h5>
                    
                        <h5>3. <?=$this->translate ( 'Our autosuggest system (based on your IP) says you are located near:').' '.
                                            '<br /><a class="ads_section" href="/'.$this->lang.'/location/change2/?location='.$this->escape($this->suggestIP).'" > '.$this->suggestIP .'</a>';?></h5>
                    
                        <h5>"<?=$this->translate ( 'A journey of a thousand miles starts with a single step') . '" '.
                                    $this->translate('Laozi.');?></h5>
                    
                    </div>
                
                <?php endif;?>

    
            <?php echo $this->paginationControl($this->search,'Sliding','partials/paginator_search.phtml');
     ?>

            </div> <!-- /div ads -->
        </div>

        <div class="span-6 last">
        <div class="advertising">
                <!-- BEGIN PARTNER PROGRAM - DO NOT CHANGE THE PARAMETERS OF THE HYPERLINK -->
                <script language="javascript" type="text/javascript" src="http://program.epartner.es/view.asp?ref=570686&site=8346&type=html&hnb=5&js=1"></script>
                <noscript><a href="http://web.epartner.es/click.asp?ref=570686&site=8346&type=b1&bnb=1" target="_blank">
                <img src="http://program.epartner.es/view.asp?ref=570686&site=8346&b=1" border="0"/></a><br /></noscript>
                <!-- END PARTNER PROGRAM -->
        </div>    
    </div>  
</div> <!-- /main -->